package logic.UIProxyBag.uieditescene
{
	import common.core.Core;
	import common.core.GEevnt;
	import common.core.SDef;
	import common.core.UIService;
	import common.manager.GUI;
	import common.manager.ObserverEvt;
	
	import component.untils.ComponentItem;
	
	import logic.manager.UIProxy;
	import logic.ui.componentInfoMed.ButtonInfoMed;
	import logic.ui.uieditscene.TopBar;

	public class TopBarProxy	extends UIService
	{
		public function TopBarProxy()
		{
			ObserverEvt.addRec(SDef.WNDRESIZE,this,OnRecWndResize);
		}
		
		public override function destory():void
		{
			ObserverEvt.removeRec(SDef.WNDRESIZE,this,OnRecWndResize);
		}
		
		public override function start(value:* = null):void
		{	
			var ui : TopBar = new TopBar;
			
			GUI.add(TopBar.NAME,ui,false);
			GUI.setAlgin(TopBar.NAME,GUI.ALIGN_LEFT,GUI.ALIGN_TOP);
			
			GUI.open(TopBar.NAME);
			
			ui.Resize(Core.stgW,15);
			
			ObserverEvt.addRec(TopBar.SCANUITREE,this,OnRecScanUITree);
		}
		
		public override function stop():void
		{
			ObserverEvt.removeRec(TopBar.SCANUITREE,this,OnRecScanUITree);
			
			GUI.remove(TopBar.NAME);
		}
		
		
		private function OnRecScanUITree(evt : GEevnt) : void
		{
			UIProxy.SanUITree.turn();
		}
		
		private function OnRecWndResize(evt : GEevnt) : void
		{
			var ui : TopBar = GUI.find(TopBar.NAME) as TopBar;
			
			ui.Resize(Core.stgW,15);
		}
	}
}